﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MvcMall.AdminPortal.Controllers.Article.ViewModels;
using MvcMall.Framework.Mapper;
using MvcMall.Framework.Utility;

namespace MvcMall.AdminPortal.Controllers.Article.Mappers
{
    public class ArticleModelMapper : BaseMapper<MvcMall.Core.Domains.Article, ArticleModel>, IMapper<MvcMall.Core.Domains.Article, ArticleModel>
    {
        #region IMapper<User,UserViewModel> Members

        public override ArticleModel MapFrom(MvcMall.Core.Domains.Article input)
        {
            var viewModel = base.MapFrom(input);
            if (input != null)
            {
                viewModel.ArticleId = input.Id;
                viewModel.Content = Utils.HtmlDecode(input.Content);
                viewModel.ArticleCategoryIdName = input.ArticleCategory.CategoryName;
            }
            return viewModel;
        }

        #endregion
    }
}
